﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using Microsoft.Office.Interop.Word;

namespace WFL.Office.Word
{
    public class WordBorders : IEnumerable<WordBorder>
    {

        public WordBorder this[BorderType index]
        {
            get { return new WordBorder(_borders[(WdBorderType)index]); }
        }


        #region 公共属性

        public Color InsideColor
        {
            get { return (Color)_borders.InsideColor; }
            set { _borders.InsideColor = (WdColor)value; }
        }

        public ColorIndex InsideColorIndex
        {
            get { return (ColorIndex)_borders.InsideColorIndex; }
            set { _borders.InsideColorIndex = (WdColorIndex)value; }
        }

        public LineStyle InsideLineStyle
        {
            get { return (LineStyle)_borders.InsideLineStyle; }
            set { _borders.InsideLineStyle = (WdLineStyle)value; }
        }

        public LineWidth InsideLineWidth
        {
            get { return (LineWidth)_borders.InsideLineWidth; }
            set { _borders.InsideLineWidth = (WdLineWidth)value; }
        }

        public Color OutsideColor
        {
            get { return (Color)_borders.OutsideColor; }
            set { _borders.OutsideColor = (WdColor)value; }
        }

        public ColorIndex OutsideColorIndex
        {
            get { return (ColorIndex)_borders.OutsideColorIndex; }
            set { _borders.OutsideColorIndex = (WdColorIndex)value; }
        }

        public LineStyle OutsideLineStyle
        {
            get { return (LineStyle)_borders.OutsideLineStyle; }
            set { _borders.OutsideLineStyle = (WdLineStyle)value; }
        }

        public LineWidth OutsideLineWidth
        {
            get { return (LineWidth)_borders.OutsideLineWidth; }
            set { _borders.OutsideLineWidth = (WdLineWidth)value; }
        }

        #endregion


        private Borders _borders;

        internal WordBorders(Borders borders)
        {
            _borders = borders;
        }



        #region IEnumerable<WordBorder> 成员

        public IEnumerator<WordBorder> GetEnumerator()
        {
            foreach (Border border in _borders)
            {
                yield return new WordBorder(border);
            }
        }

        #endregion

        #region IEnumerable 成员

        IEnumerator IEnumerable.GetEnumerator()
        {
            foreach (Border border in _borders)
            {
                yield return new WordBorder(border);
            }
        }

        #endregion

    }
}
